package otherOrganizations;

import repast.simphony.engine.schedule.ScheduledMethod;
import repast.simphony.essentials.RepastEssentials;
import enviornment.Weather;
/**
 * Represents met office in the simulation of SMEs in floods. Met office is responsible to
 * publish weather information. Environment agency is one of the subscriber of weather information.
 * @author Chunhui Li
 *
 */

public class MetOffice extends GovernmentAgent{
    static Weather report;// Met Office is responsible to generate a weather report every hour for the future half a day
	
    public MetOffice() {
		report = new Weather();		
	}
    	
	public Weather getReport(){
		return report;
	}
	
	/**
	 * Met office publishes weather information of the future 12 hours every 6 hours. It is 
	 * using schedule mechanism of Repast.
	 */
	@ScheduledMethod(start =1, interval = 6)
	public void step(){
		double t = RepastEssentials.GetTickCount() + 12.0 ;
		boolean bad = true;
		generateReport(t, bad);	
	}
	
	/**
	 * Generates a weather report which contains the information of weather time 
	 * and whether it will be bad weather.
	 * @param t the time tick when the report is generated
	 * @param bad whether it is bad weather for flooding
	 * @return the newly generated report
	 */
	public Weather generateReport(double t, boolean bad){		
		report.setBadWeather(bad);
		report.setWeatherTime(t);
		return report;
		
	}
	
}
